<template>
  <div class="yd-dots">
    <div class="dots-item" v-for="item in 3" :key="item">
      <a
        href="javascript:void(0)"
        :style="{backgroundColor:item-1===currentIndex?dotBgColor:'#cad2de'}"
        @click="dotClick(item-1)"
      ></a>
    </div>
  </div>
</template>

<script>
export default {
  name: "Dots",
  props: {
    itemLen: Number,
    currentIndex: Number,
    dotBgColor: String
  },
  setup(props, cxt) {
    const dotClick = index => {
      cxt.emit("dotClick", index);
    };
    return {
      dotClick
    };
  }
};
</script>

<style lang="scss" scoped>
.yd-dots {
  position: absolute;
  bottom: 15px;
  width: 100%;
  height: 14px;
  line-height: 14px;
  text-align: center;
  z-index: 1;
  .dots-item {
    display: inline-block;
    margin: 3px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.3);
    & > a {
      display: block;
      width: 7px;
      height: 7px;
      border-radius: 50%;
    }
  }
}
</style>